const fs = require("fs");
const p = new Promise(function (resolve, reject) {
  fs.readFile("hello.txt", function (err, data) {
    if (err) reject(err);
    resolve(data);
  });
});
p.then(
  function (value) {
    console.log(value.toString());
  },
  function (reason) {
    console.error("读取失败");
  }
);
